﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class groupstarter : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    private string GetGroupName()
    {
        System.Security.Principal.IPrincipal ip =
            HttpContext.Current.User;
        string group = ip.Identity.Name;
        if (group == "")
        {
            Response.Redirect("login.aspx");
        }
        return group;
    }
    protected void Button13_Click(object sender, EventArgs e)
    {
        //student
        string group = GetGroupName();
        Response.Redirect(Launcher.LaunchStudentUrl(group), true);
    }
    protected void Button12_Click(object sender, EventArgs e)
    {
        //audience
        string group = GetGroupName();
        Response.Redirect(
            Launcher.LaunchAudienceUrl(group)
            , true);
    }
    protected void Button14_Click(object sender, EventArgs e)
    {
        //discussant
        string group = GetGroupName();
        Response.Redirect(
            Launcher.LaunchDiscussantUrl(group)
            , true);
    }
    protected void Button26_Click(object sender, EventArgs e)
    {
        //presenter
        string group = GetGroupName();
        Response.Redirect(
            Launcher.LaunchPresenterUrl(group)
            , true);
    }
    protected void Button27_Click(object sender, EventArgs e)
    {
        //Manager
        string group = GetGroupName();
        Response.Redirect(
            Launcher.LaunchManagerUrl(group)
            , true);
    }
    protected void Button28_Click(object sender, EventArgs e)
    {
        //Overview
        string group = GetGroupName();
        Response.Redirect(
            Launcher.LaunchOverviewUrl(group)
            , true);
    }
    protected void Button29_Click(object sender, EventArgs e)
    {
        //Previous x2
        string group = GetGroupName();
        Response.Redirect(
            Launcher.LaunchAdjacentViewUrl(group,-2)
            , true);
    }
    protected void Button30_Click(object sender, EventArgs e)
    {
        //Previous
        string group = GetGroupName();
        Response.Redirect(
            Launcher.LaunchAdjacentViewUrl(group, -1)
            , true);
    }
    protected void Button31_Click(object sender, EventArgs e)
    {
        //Next
        string group = GetGroupName();
        Response.Redirect(
            Launcher.LaunchAdjacentViewUrl(group, 1)
            , true);
    }
    protected void Button32_Click(object sender, EventArgs e)
    {
        //Next x2
        string group = GetGroupName();
        Response.Redirect(
            Launcher.LaunchAdjacentViewUrl(group, 2)
            , true);
    }
    protected void Button33_Click(object sender, EventArgs e)
    {
        //Current
        string group = GetGroupName();
        Response.Redirect(
            Launcher.LaunchAdjacentViewUrl(group,0)
            , true);

    }
    protected void Button34_Click(object sender, EventArgs e)
    {
        //Questioner
        string group = GetGroupName();
        //Response.Redirect(
        //    Launcher.LaunchAdjacentViewUrl(group, 0)
        //    , true);
        Response.Redirect(
            Launcher.LaunchDiscussantUrl(group)
            //Launcher.LaunchPresenterUrl(group)
            , true);


    }
    protected void Button35_Click(object sender, EventArgs e)
    {
        //Answerer
        string group = GetGroupName();
        int cnt = 0;
        if (Launcher.GetNumberOfGroup(group, out cnt))
        {
            Response.Redirect(
                Launcher.LaunchAdjacentViewUrl(group, cnt)
                , true);
        }
    }
}
